package com.goudan.practice.print;

import java.lang.reflect.Field;
import java.util.Arrays;

/**
 * 面试中遇到的问题，说出打印都是什么？为什么
 */
public class Interview001 {

    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        Class intClazz = Integer.class.getDeclaredClasses()[0];
        Field myCache = intClazz.getDeclaredField("cache");
        myCache.setAccessible(true);
        Integer[] newCache = (Integer[]) myCache.get(intClazz);
        System.out.println(Arrays.asList(newCache));
        newCache[132] = 6666;
        int a = 2;
        int b = a + a;
        System.out.printf(" %d + %d = %d\n", a, a, b);
        System.out.printf(" %d + %d = %s\n", a, a, b);
        System.out.printf(" %d + %d = %s\n", a, a, String.valueOf(b));
    }
}
